package com.xm;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 重试
 *
 * @param
 * @return
 * @date 2024/10/9 15:16
 * @author lililiang
 */
@Slf4j
@RestController
@RequestMapping("/cache")
public class CacheController {

    @Resource
    private CacheService cacheService;

    @PostMapping("/t1")
    public List<String> test() {
        return cacheService.getUserList();
    }

    @PostMapping("/getUserListById")
    public List<String> getUserListById(@RequestBody User user) {
        return cacheService.getUserListById(user.getId());
    }

    @PostMapping("/getUserListByUser")
    public List<String> getUserListByUser(@RequestBody User user) {
        return cacheService.getUserListByUser(user);
    }

    @PostMapping("/getUserListCondition")
    public List<String> getUserListCondition(@RequestBody User user) {
        return cacheService.getUserListCondition(user);
    }


    @PostMapping("/getUserListUnless")
    public List<String> getUserListUnless(@RequestBody User user) {
        return cacheService.getUserListUnless(user);
    }

    @PostMapping("/updateUser")
    public List<String> updateUser(@RequestBody User user) {
        return cacheService.updateUser(user);
    }

    @PostMapping("/deleteUser")
    public List<String> deleteUser(@RequestBody User user) {
        return cacheService.deleteUser(user);
    }
}
